import { defineStore } from 'pinia'
import { getEntireRoles, getEntireDepartments } from '@/service/main/main'
interface IMainState {
  entireRoles: any[]
  entireDepartments: any[]
}
const useMainStore = defineStore('main', {
  state: (): IMainState => ({
    entireRoles: [],
    entireDepartments: []
  }),
  actions: {
    async fetchEntireDataAction() {
      const roleResult = await getEntireRoles()
      const departmentsResult = await getEntireDepartments()
      this.entireDepartments = departmentsResult.data.list
      this.entireRoles = roleResult.data.list
    }
  }
})

export default useMainStore
